<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html>
<head>
    <title>招标项目管理报价密码管理</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>
<body class="skin-blue sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
    </section>
    
    <section class="content">
        <div class=" box box-success ">
            
            <form id="form" class="form-horizontal" action="${ctx }/psProject/setPassword.html" method="post">
                <input id="projId" hidden="true" name="projId" value="${projId}" />
                
                
                <div class="box-body">
                    
                    <div class="form-group form-group-xs" style="display:none" >
                        <label for="recpAddr" class="col-sm-3 control-label"><span class="required">*</span>原始密码：</label>
                        <div class="col-sm-7">
                             <input class="form-control" id="oldPassword"   value="${form.password }" type="text" >
                        </div>
                    </div>
                    
                    <div class="form-group form-group-xs">
                        <label for="recpAddr" class="col-sm-3 control-label"><span class="required">*</span>密码：</label>
                        <div class="col-sm-7">
                             <input class="form-control" id="password" name="password"   placeholder="请输入密码" type="text" >
                        </div>
                    </div>
                    
                    <div class="form-group form-group-xs">
                        <label for="recpAddr" class="col-sm-3 control-label"><span class="required">*</span>密码确认：</label>
                        <div class="col-sm-7">
                             <input class="form-control" id="passwordAffirm"   placeholder="请确认密码" type="text" >
                        </div>
                    </div>
                     
                    
                </div>
                
                <div class="box-footer text-center">
                        <button type="button" onclick="save();" class="btn btn-success btn-sm">保&nbsp;存</button>
                     </div>
            </form>
        </div>
    </section>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">

    //保存
    function save() {
       if (!validate()) {
           return;
       }  
       $.HN.message.confirm('确定要保存吗？', '', '').on(function (e) {
          if (e) {
                   $("#form").ajaxSubmit({
                       dataType : "json",
                       timeout: 10000,
                       success : function(result) {
                           if (result.success) {
                               $.HN.message.alert("操作成功！", "消息", "success", function() {
                            	   top.mainframe.document.location = "${ctx}/psProject/toPsjectList.html";
                               });
                               
                           } else {
                               $.HN.message.alert(result.msg || "操作失败", "消息", "error");
                           }
                       }
                   });
              }
         });
       
   }
   
 
 

 
 
//效验
 function validate() {
     
     var password = $.trim($("#password").val());
     if (password == null || password == "") {
         $.HN.message.alert("密码不能为空！请输入密码", "提示信息", "warn");
         return false;
     } else if (!/^[0-9]+$/.test(password)) {
         $.HN.message.alert("密码只能由数字组成！请重新输入", "提示信息", "warn");
         return false;
     }
     
     
     var passwordAffirm = $.trim($("#passwordAffirm").val());
     if (passwordAffirm == null || passwordAffirm == "") {
         $.HN.message.alert("密码确认不能为空！请输入密码", "提示信息", "warn");
         return false;
     } else if (passwordAffirm != password ) {
         $.HN.message.alert("密码确认与密码不一致！请重新输入", "提示信息", "warn");
         return false;
     }
     
   
     return true;
 }
    
    </script>
    
</body>
</html>
